<?php
declare(strict_types=1);
namespace SixShop\Message\Model;

use SixShop\Message\Enum\NotificationsTypeEnum;
use think\Model;
use think\model\relation\BelongsTo;

class MessageNotificationsModel extends Model
{
    protected function getOptions(): array
    {
        return [
            'name' => 'message_notifications',
            'type' => [
                'type' => NotificationsTypeEnum::class,
                'template_context' => 'json'
            ]
        ];
    }

    public function template():BelongsTo
    {
        return $this->belongsTo(MessageTemplatesModel::class, 'template_code', 'code');
    }
}